<!doctype html>
<html>
<head>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0">
<title>我的车辆</title>
<link href="../../css/newStyle.css" type="text/css" rel="stylesheet" />
<link href="../../css/newStyle.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="../../js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="../../js/common.js"></script>
<script type="text/javascript" src="../../js/gbRst.js"></script>
<script type="text/javascript" src="../../js/utils.js"></script>
<script type="text/javascript" src="../../js/openId.js"></script>
<script type="text/javascript" src="../../js/header&footer.js"></script>
<script type="text/javascript" src="../../js/manhuaDate.1.0.js"></script>
<script type="text/javascript" src="../../js/check.js"></script>
<script type="text/javascript" src="../../js/qmsk-1.2.js"></script>
<script type="text/javascript">

$(function (){
	$("input.doubledate").manhuaDate({					       
		Event : "click",//可选				       
		Left : 0,//弹出时间停靠的左边位置
		Top : -16,//弹出时间停靠的顶部边位置
		fuhao : "-",//日期连接符默认为-
		isTime : false,//是否开启时间值默认为false
		beginY : 1940,//年份的开始默认为1949
		endY :2100//年份的结束默认为2049
	});
	for(var i=0,attrDet=[];i<$(".messageAbb").length;i++){
		attrDet.push($(".messageAbb").eq(i).html());
	}//存储商品详情
	for(var i=0;i<$(".messageAbb").length;i++){
		$(".messageAbb").eq(i).html($(".messageAbb").eq(i).html().substr(0,40)+"…");	
	}
	$(".messageAbb").click(function(){
		if($(this).hasClass("showAbb")){
			$(this).html($(this).html().substr(0,40)+"…");
			$(this).removeClass("showAbb");
		}else{
		var index=$(".messageAbb").index(this);
		$(this).html(attrDet[index]);	
		$(this).addClass("showAbb");
		}
	})//精简显示消息
	
	getRecord()
})

function getRecord(){
	var dt = _findInfo("../../../customerCarInfo/find/customerCarInfo/"+_openId, null);
	if(IsNotEmpty(dt)&&dt.state==0){
		printDataToPage(dt)
	}
}

function showNoResult(){
	$("#noResult").show()
}

function printDataToPage(dt){
	for ( var i = 0; i < dt.result.data.length; i++) {
		var id = getHtmlString(getHeadIndexValue(i, dt, "id"))
		var carTypeName = getHtmlString(getHeadIndexValue(i, dt, "carSystemName"))+"  "+getHtmlString(getHeadIndexValue(i, dt, "carTypeName"))
		var license = getHtmlString(getHeadIndexValue(i, dt, "license"))
		var insFirstDate = getHtmlString(getHeadIndexValue(i, dt, "insFirstDate")).replace(/\s/gi,'').substring(0,10)
		var insEndDate = getHtmlString(getHeadIndexValue(i, dt, "insEndDate")).replace(/\s/gi,'').substring(0,10)
		var nextDate = getHtmlString(getHeadIndexValue(i, dt, "nextDate")).replace(/\s/gi,'').substring(0,10)
		var checkDate = getHtmlString(getHeadIndexValue(i, dt, "checkDate")).replace(/\s/gi,'').substring(0,10)
		var htm = "<section class=\"myCars\"><div class=\"person\">品牌/车型<span class=\"red\">*</span><br><input id='carTypeName_"+id+"'  value='"+carTypeName+"' type=\"text\" class=\"txt\"></div><div class=\"person\">车牌号<span class=\"red\">*</span><br>"
		+"<input type=\"text\"  id='license_"+id+"' value='"+license+"'  class=\"txt\"></div><div class=\"person\">首保日期<span class=\"red\">*</span><br><input type=\"text\"  id='insFirstDate_"+id+"' value='"+insFirstDate+"' readonly   class=\"txt doubledate\" readonly></div><div class=\"person\">保险到期<span class=\"red\">*</span><br><input type=\"text\" id='insEndDate_"+id+"' readonly value='"+insEndDate+"'   class=\"txt doubledate\" readonly></div><div class=\"person\">"+
        "保养日期<span class=\"red\">*</span><br><input id='nextDate_"+id+"' value='"+nextDate+"' readonly type=\"text\" class=\"txt doubledate\" ></div><div class=\"person\">年检日期<span class=\"red\">*</span><br><input id='checkDate_"+id+"' value='"+checkDate+"'  type=\"text\" class=\"txt doubledate\" readonly></div><div class=\"give\"><input type=\"button\" value=\"保存\" onclick='saveInfo("+id+")' class=\"giveBtn\"></div></section>"
		$("#info").append(htm)
	}
	
}

/* function deleteRecord(id){
	var dt = _deleteInfo("../../../recommendMan/del", {"id":id});
	if(IsNotEmpty(dt)&&dt.state==0){
		$("#record_"+id).remove();
	}
	
} */


function saveInfo(id){
	var carTypeName = $("#carTypeName_"+id).val()
	var license = $("#license_"+id).val()
	var insFirstDate = $("#insFirstDate_"+id).val()
	var insEndDate = $("#insEndDate_"+id).val()
	var nextDate = $("#nextDate_"+id).val()
	var checkDate = $("#checkDate_"+id).val()
	var heads = new Array("carTypeName","license","insFirstDate","insEndDate","nextDate","checkDate","id");
	var datas = new Array(carTypeName,license,insFirstDate,insEndDate,nextDate,checkDate,id);
	var json = _getJsonParseEditStr(heads, datas);
	
	var dt= _editInfo("../../../customerCarInfo/edit", {'data':json})
	if(IsNotEmpty(dt)&&dt.state==0){
		
	}
	
}
</script>
</head>

<body style="background:#eee">
<div class="wrapper" style="padding-bottom:30px;">
  <div class="container">
  <div class="placeTit"><a href="javascript:history.go(-1)" class="back"></a>我的车辆</div>
  <div id= "info"></div>
  	<!-- <section class="myCars">
    <div class="person">
        品牌/车型<span class="red">*</span><br>
     	<input type="text" class="txt">
    </div>
    <div class="person">
        车牌号<span class="red">*</span><br>
     	<input type="text" class="txt">
    </div>
    <div class="person">
        首保日期<span class="red">*</span><br>
     	<input type="text" class="txt doubledate1" readonly>
    </div>
    <div class="person">
        保险到期<span class="red">*</span><br>
     	<input type="text" class="txt doubledate" readonly>
    </div>
    <div class="person">
        保养日期<span class="red">*</span><br>
     	<input type="text" class="txt doubledate1" readonly>
    </div>
    <div class="person">
        年检日期<span class="red">*</span><br>
     	<input type="text" class="txt doubledate1" readonly>
    </div>
    <div class="give">
        <input type="button" value="保存" class="giveBtn">
    </div>
    </section>
    <section class="myCars">
    <div class="person">
        品牌/车型<span class="red">*</span><br>
     	<input type="text" class="txt">
    </div>
    <div class="person">
        车牌号<span class="red">*</span><br>
     	<input type="text" class="txt">
    </div>
    <div class="person">
        首保日期<span class="red">*</span><br>
     	<input type="text" class="txt doubledate1" readonly>
    </div>
    <div class="person">
        保险到期<span class="red">*</span><br>
     	<input type="text" class="txt doubledate" readonly>
    </div>
    <div class="person">
        保养日期<span class="red">*</span><br>
     	<input type="text" class="txt doubledate1" readonly>
    </div>
    <div class="person">
        年检日期<span class="red">*</span><br>
     	<input type="text" class="txt doubledate1" readonly>
    </div>
    <div class="give">
        <input type="button" value="保存" class="giveBtn">
    </div>
    </section> -->
  </div>
</div>
</body>
</html>
